home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Multimedia & Desktop / sk8 / SK8InJava / Code / Dialogs / MessageDialog.java
Encoding:
Java Source  |  1997-02-27  |  977 b   |  41 lines  |  [TEXT/CWIE]

  1. /*  SK8 © 1997 Apple Computer, Inc.
  2.     This code is protected under the current SK8 License
  3.     See http://sk8.research.apple.com/ for more information
  4.     Apple Research Laboratories
  5. */
  6.  
  7.  
  8. import java.awt.*;
  9.  
  10. class messagedialog extends Dialog {
  11.     Label messagelabel;
  12.     Button okbutton;
  13.  
  14.     // constructor. 
  15.  
  16.     messagedialog(Frame dw, String text) {
  17.         super(dw, "Message Window", true);
  18.         
  19.         //Create middle section.
  20.         Panel p1 = new Panel();
  21.         Label label = new Label(text);
  22.         this.messagelabel = label;
  23.         p1.add(label);
  24.         add("Center", p1);
  25.  
  26.         //Create bottom row.
  27.         Panel p2 = new Panel();
  28.         p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
  29.         okbutton = new Button("Ok");
  30.         p2.add(okbutton);
  31.         add("South", p2);
  32.  
  33.         //Initialize this dialog to its preferred size.
  34.         pack();
  35.     }
  36.  
  37.     public boolean action(Event event, Object arg) {
  38.         hide();
  39.         return true;
  40.     }
  41. }